<script setup>
import { ref, onMounted } from "vue";
import { artGetChannelsService } from "@/api/article";
defineProps({
  modelValue: {
    type: [String]
  },
  width: {
    type: [String]
  }
})
const emit = defineEmits(['update:modelValue'])
const channelList = ref([]);
const getChannelList = async () => {
  const res = await artGetChannelsService();
  console.log(res.data.data);
  channelList.value = res.data.data;
};
onMounted(() => {
  getChannelList();
});
</script>
<template>
  <!-- 分类下拉框小组件 -->
  <el-select :model-value="modelValue" @update:modelValue="emit('update:modelValue', $event)" :style="{ width }">

    <el-option v-for="channel in channelList" :key="channel.id" :label="channel.cateName" :value="channel.id">
    </el-option>
  </el-select>
</template>
